package com.zzyl.mapper;

import com.github.pagehelper.Page;
import com.zzyl.entity.NursingProject;
import com.zzyl.vo.NursingProjectPlanVo;
import com.zzyl.vo.NursingProjectVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface NursingProjectMapper {

    /**
     * 查询符合条件的项目条件
     * @param name
     * @param status
     * @return
     */
    Page<NursingProjectVo> selectByPage (String name , Integer status);

    void add(NursingProject nursingProject);

    NursingProjectVo getById(Long id);

    void update(NursingProject nursingProject);

    /**
     * 查询所有护理项目
     * @return
     */
    @Select("select * from nursing_project")
    List<NursingProjectVo> getAllProject();

    /**
     * 护理项目的禁用启用
     * @param id 护理项目id
     * @param status 护理项目状态
     * @return
     */
    @Update("update nursing_project set status = #{status} where id = #{id}")
    void updateStatus(Long id, Integer status);

    /**
     * 删除护理项目
     * @param id 护理项目id
     * @return
     */
    @Delete("delete from nursing_project where id = #{id}")
    void deleteProject(Long id);

    @Select("select * from nursing_project_plan where project_id = #{id}")
    List<NursingProjectPlanVo> getProjectPlan(Long id);
}
